# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Michael Mason <ms13sp@gmail.com>
pkgname=postgrey
pkgver=1.37
pkgrel=2
pkgdesc="Postfix policy server implementing greylisting"
url="http://postgrey.schweikert.ch/"
arch="noarch !x86" # perl-db
license="GPL-2.0-or-later"
depends="perl perl-db perl-net-dns perl-net-server perl-io-multiplex
	perl-net-rblclient perl-parse-syslog perl-netaddr-ip"
pkgusers="postgrey"
pkggroups="postgrey"
checkdepends="perl-file-slurper"
install=postgrey.pre-install
source="https://postgrey.schweikert.ch/pub/postgrey-$pkgver.tar.gz
	postgrey.confd
	postgrey.initd"

check() {
	cd test
	perl test.pl
}

package() {
	install -m755 -D $pkgname  "$pkgdir"/usr/sbin/$pkgname
	mkdir -p "$pkgdir"/var/spool/postfix/$pkgname
	chown postgrey:postgrey "$pkgdir"/var/spool/postfix/$pkgname
	chmod 770 "$pkgdir"/var/spool/postfix/$pkgname
	install -m755 -D contrib/postgreyreport "$pkgdir"/usr/bin/postgreyreport
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m644 -D postgrey_whitelist_clients "$pkgdir"/etc/postfix/postgrey_whitelist_clients
	install -m644 -D postgrey_whitelist_recipients "$pkgdir"/etc/postfix/postgrey_whitelist_recipients
	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="369968212ea60539efc0d4a7ae84f7c3ce13f5622e6ee070a0089423ef81ca8f7541ebd20289291d0e6a3aec2ca30dbc9c0d9c0a6f0a686adfadb5d0dd7830ca  postgrey-1.37.tar.gz
cf74ad36c07a3807d85de9c60cfaea31b3c04adebbe306e72d61bf14c1a17e4a07654f0a96919091735b94ea5e3b7847de5e02d4801b3f58240e5622d8ac0d10  postgrey.confd
fdfdf29d4eae3e74cb673bfd51dea205949afc55630d05ca62a95c45e94b1091aea57d47ea7ddece3957922ece04b23f484320bf374ab2520119e1cd95dc2f3f  postgrey.initd"
